GDK W32: Print error code along with the error message
authorРуслан Ижбулатов <lrn1986@gmail.com>
Mon, 21 Mar 2016 16:25:19 +0000 (16:25 +0000)
committerРуслан Ижбулатов <lrn1986@gmail.com>
Fri, 25 Mar 2016 22:04:58 +0000 (22:04 +0000)
Error codes can be easily looked up in an error code list
and/or googled up. Error messages, while descriptive, often
describe the wrong thing, and the messages themselves are not
part of the documentation of a function, unlike error codes.
It would be preferable to have the code, or both.

https://bugzilla.gnome.org/show_bug.cgi?id=763913

gdk/win32/gdkmain-win32.c

index a8a765063ae1d6b6f7543c2c6fa2f65ee438dc76..b170612a7190c4d324911dfa398ff577e631731a 100644 (file)
@@ -134,10 +134,11 @@ _gdk_win32_windowing_init (void)
 
 void
 _gdk_win32_api_failed (const gchar *where,
-                     const gchar *api)
+                       const gchar *api)
 {
-  gchar *msg = g_win32_error_message (GetLastError ());
-  g_warning ("%s: %s failed: %s", where, api, msg);
+  DWORD error_code = GetLastError ();
+  gchar *msg = g_win32_error_message (error_code);
+  g_warning ("%s: %s failed with code %lu: %s", where, api, error_code, msg);
   g_free (msg);
 }